/**
 * 
 */
package sob.netcode.threadapp;

/**
 * @author blackcore
 * @date 2013-11-15
 * @describe
 */
public class Test {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// 继承Thread创建线程
		testImplThreader();
		// 实现 Runnable创建线程
		testImplRunnable();
		// ExecutorService会创建线程池
		testImplExecutor();

	}

	static void testImplThreader() {
		Thread t1 = new ImplThreader();
		Thread t2 = new ImplThreader();
		t1.start(); // start the first thread. This calls the run() method.
		t2.start(); // this starts the 2nd thread. This calls the run() method.
	}

	static void testImplRunnable() {
		Thread t1 = new Thread(new ImplRunnable());
		Thread t2 = new Thread(new ImplRunnable());
		t1.start(); // start the first thread. This calls the run() method.
		t2.start(); // this starts the 2nd thread. This calls the run() method.
	}

	static void testImplExecutor() {
		ImplExecutor executor = new ImplExecutor();
		executor.SingleThread();

		executor.MutiThread();

		executor.ScheduleThread();

		executor.CloseExecutorService(10);
	}

}
